package com.hy.admin.dao;

import com.hy.admin.entity.MessageEntity;
import com.hy.admin.helper.response.MessageResponse;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface MessageDao {
    int deleteByPrimaryKey(Long id);

    int insert(MessageEntity record);

    int insertSelective(MessageEntity record);

    MessageEntity selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(MessageEntity record);

    int updateByPrimaryKey(MessageEntity record);

    /**
     * 查询用户未读消息数量
     * @param memberId
     * @return
     */
    int selectUnreadCountByMemberId(Long memberId);

    /**
     * 查询用户消息列表
     * @param memberId
     * @return
     */
    List<MessageResponse> selectByMemberId(Long memberId);

    /**
     * 批量插入用户消息
     * @param messageList
     * @return
     */
    int batchInsert(List<MessageEntity> messageList);

    /**
     * 修改消息查看状态
     * @param memberId
     * @return
     */
    int updateCheckState(Long memberId);
}